precision mediump float;
//precision highp float;
varying vec2 v_texcoord;
uniform sampler2D texture;
uniform float alpha;
uniform vec4 u_TexRange;
uniform vec2 u_offset;
#include?BLUR_FILTER  "parts/BlurFilter_ps_uniform.glsl";
#include?COLOR_FILTER "parts/ColorFilter_ps_uniform.glsl";
#include?GLOW_FILTER "parts/GlowFilter_ps_uniform.glsl";
#include?COLOR_ADD "parts/ColorAdd_ps_uniform.glsl";

void main() {
   vec2 newTexCoord;
   newTexCoord.x = mod(u_offset.x + v_texcoord.x,u_TexRange.y) + u_TexRange.x;
   newTexCoord.y = mod(u_offset.y + v_texcoord.y,u_TexRange.w) + u_TexRange.z;
   vec4 color= texture2D(texture, newTexCoord);
   color.a*=alpha;
   gl_FragColor=color;
   #include?COLOR_ADD "parts/ColorAdd_ps_logic.glsl";   
   #include?BLUR_FILTER  "parts/BlurFilter_ps_logic.glsl";
   #include?COLOR_FILTER "parts/ColorFilter_ps_logic.glsl";
   #include?GLOW_FILTER "parts/GlowFilter_ps_logic.glsl";
}